#!/bin/bash

if [ "$1" == "w" ]; then

    # 配置
    file_name="jielong.exe"
    dist_path="../dist/windows/"
    # 构建
    cd src
    # go env -w CGO_ENABLED=0 GOARCH=amd64 GOOS=windows
    # go build -o jielong.exe .
    CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -o ${dist_path}${file_name} .
    cd ${dist_path}
    # ./${file_name} --dev

elif [ "$1" == "l" ]; then

    # @echo off
    file_name="jielong"
    remote_host="root@172.22.0.82"
    upload_path="~/youdu_service/jielong"
    # @REM 构建linux版本
    cd src
    # go env -w CGO_ENABLED=0 GOARCH=amd64 GOOS=linux
    # go env -w CGO_ENABLED=0 GOARCH=arm64 GOOS=linux
    CGO_ENABLED=0 GOARCH=arm64 GOOS=linux go build -o ../dist/linux/${file_name} .



    # @REM 上传到Linux服务器，然后去服务端安装服务
    # cd ../dist/linux
    # ssh ${remote_host} "mkdir -p ${upload_path}"
    # scp -r ./ ${remote_host}:${upload_path}

elif [ "$1" == "status" ]; then
    echo "查询状态..."
    # 在这里编写查询状态的代码
else
    echo "未知的操作: $1"
    echo "用法: $0 {w|l|status}"
    exit 1
fi
